﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.Composition;
using System.ComponentModel.Composition.Hosting;
using System.Reflection;


namespace Plugins
{
	public class ComposePlugins
	{
		//[Import(typeof(IPluginContract))]
		//public IPluginContract CurrentPlugin { get; set; }

		/*This can be used for multiple of the same plugins
		 * [ImportMany(typeof(IPluginContract))]
		 * public List<IPluginContract CurrentPlugin { get; set; }
		 */
		[Import(typeof(string))]
		public string plug;

		public void Compose()
		{
			AssemblyCatalog catalog = new AssemblyCatalog(Assembly.GetExecutingAssembly());
			CompositionContainer compositionContainer = new CompositionContainer(catalog);
			compositionContainer.ComposeParts(this);

			//Code to use the plugin goes here.

		}

	}
}
